package com.diyunapp.xilinapp.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.diyunapp.xilinapp.R;
import com.diyunapp.xilinapp.bean.WaitPayBean;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/6/23.
 */
public class WaitPayAdapter extends BaseAdapter {
    private List<WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean> info
            = new ArrayList<WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean>();
    private List<WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean.ExtendOrderGoodsBean> info1
            = new ArrayList<WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean.ExtendOrderGoodsBean>();
    private Context context;
    //        private LendNoDebtFragment lendNoDebtFragment;
    public WaitPayAdapter(Context context) {
        super();
        this.context = context;
    }
    public void setList(List<WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean> list) {
        this.info = list;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }
private ViewHolder viewHolder;
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (null == convertView) {
            LayoutInflater layoutInflater = LayoutInflater.from(context);
            convertView = layoutInflater.inflate(R.layout.item_pay, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder =(ViewHolder) convertView.getTag();
        }
        WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean bean=info.get(position);
        WaitPayBean.DatasBean.OrderGroupListBean.OrderListBean.ExtendOrderGoodsBean bean1=info1.get(position);
        viewHolder.shopName.setText(bean.getStore_name());
        viewHolder.intentState.setText("待付款");
        viewHolder.goodsIntroduce.setText(bean1.getGoods_name());
        viewHolder.intentNum0.setText("X"+bean1.getGoods_num()+"件");
        viewHolder.intentPrice.setText("¥"+bean1.getGoods_price());
        viewHolder.addPrice.setText("¥"+bean1.getGoods_pay_price());
        viewHolder.addNum.setText("共 "+bean1.getGoods_pay_price()+" 件，合计");


//        String state=bean.getOrder_state();
//        if(state=="0"){
//            viewHolder.intentState.setText("已取消");
//        } else if (state=="20"){
//            viewHolder.intentState.setText("待发货");
//        }
//        else if(state=="30"){
//            viewHolder.intentState.setText("待收货");
//        }
//        else if (state=="40"){
//            viewHolder.intentState.setText("待评价");
//        }
//        else{
//            viewHolder.intentState.setText("未付款");
//        }


        return null;
    }

     class ViewHolder {
        @Bind(R.id.shoplogo)
        ImageView shoplogo;
        @Bind(R.id.shop_name)
        TextView shopName;
        @Bind(R.id.intent_state)
        TextView intentState;
        @Bind(R.id.goods_show)
        ImageView goodsShow;
        @Bind(R.id.goods_introduce)
        TextView goodsIntroduce;
        @Bind(R.id.intent_price)
        TextView intentPrice;
        @Bind(R.id.intent_color)
        TextView intentColor;
        @Bind(R.id.intent_size)
        TextView intentSize;
        @Bind(R.id.intent_num0)
        TextView intentNum0;
        @Bind(R.id.youhuiquan)
        TextView youhuiquan;
        @Bind(R.id.youhuiquan_money)
        TextView youhuiquanMoney;
        @Bind(R.id.jifen)
        TextView jifen;
        @Bind(R.id.jifen_money)
        TextView jifenMoney;
        @Bind(R.id.add_num)
        TextView addNum;
        @Bind(R.id.add_price)
        TextView addPrice;
        @Bind(R.id.cancel_bn)
        Button cancelBn;
        @Bind(R.id.pay_right_away)
        TextView payRightAway;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
